package com.xyht.sca_s.student_manage_system.modules.user.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FormatUtil {
    private static String REGEX_PHONE = "^((1[0-9][0-9])|(14[0-9])|(15([0-9]))|(17[0-9])|(18[0-9]))\\d{8}$";

    public static Boolean phoneFormat(String phone){
        Boolean b;
        if(phone.length() != 11){
            b = false;
        }else{
            Pattern p = Pattern.compile(REGEX_PHONE);
            Matcher m = p.matcher(phone);
            boolean isMatch = m.matches();
            if(isMatch){
                b = true;
            } else {
                b = false;
            }
        }
        return b;
    }
}
